﻿Imports System
Imports System.Workflow.ComponentModel
Imports System.Workflow.ComponentModel.Design

Namespace System.Workflow.ComponentModel.Compiler
    Public Class CompositeActivityCodeGenerator
        Inherits ActivityCodeGenerator
        ' Methods
        Public Overrides Sub GenerateCode(ByVal manager As CodeGenerationManager, ByVal obj As Object)
            If (manager Is Nothing) Then
                Throw New ArgumentNullException("manager")
            End If
            If (obj Is Nothing) Then
                Throw New ArgumentNullException("obj")
            End If
            Dim compositeActivity As CompositeActivity = [TryCast](obj,CompositeActivity)
            If (compositeActivity Is Nothing) Then
                Throw New ArgumentException(SR.GetString("Error_UnexpectedArgumentType", New Object() { GetType(CompositeActivity).FullName }), "obj")
            End If
            MyBase.GenerateCode(manager, obj)
            Dim activity2 As Activity
            For Each activity2 In Helpers.GetAllEnabledActivities(compositeActivity)
                Dim generator As ActivityCodeGenerator
                For Each generator In manager.GetCodeGenerators(activity2.GetType)
                    generator.GenerateCode(manager, activity2)
                Next
            Next
        End Sub

    End Class
End Namespace

